<template>
  <div>
    <Bluetable ref="blueTable" :t-head="tHead" :t-data="tableData" :child-open="childOpen" @childOpenData="setTrue" />
    <pagination :total="query.total" :page.sync="query.page" :limit.sync="query.limit" @pagination="getList" />
    <el-dialog title="病人信息[姓撒名]" :visible.sync="childOpen" width="1150px">
      <div class="wrapper">
        <div class="content-left">
          <div class="btns"><el-button :type="type1" @click="changeBtn('1')">概览</el-button></div>
          <div class="btns"><el-button :type="type2" @click="changeBtn('2')">门诊</el-button></div>
          <div class="btns"><el-button :type="type3" @click="changeBtn('3')">住院</el-button></div>
        </div>
        <div class="content-right">
          <div class="right-top">
            <card>
              <div slot="cardHeader">病人基本信息</div>
              <div slot="cardBody" class="cardBody">
                <div class="body-left">姓名</div>
                <div class="body-right">
                  <div class="body-right-top">
                    <div class="gender">女</div>
                    <div class="age">43岁</div>
                  </div>
                  <div class="body-right-bottom">
                    <div class="item">
                      <div class="item-key">电话:</div>
                      <div class="item-value">18888888888</div>
                    </div>
                    <div class="item">
                      <div class="item-key">生日:</div>
                      <div class="item-value">1999-01-01</div>
                    </div>
                    <div class="item">
                      <div class="item-key">出生地:</div>
                      <div class="item-value">江苏</div>
                    </div>
                    <div class="item">
                      <div class="item-key">民族:</div>
                      <div class="item-value">汉</div>
                    </div>
                  </div>
                </div>
              </div>
            </card>
          </div>

          <div class="right-bottom">
            <div v-if="btnvalue === '1'">
              <el-tabs type="border-card">
                <el-tab-pane label="病史">
                  <div class="medical-history">
                    <div class="irritability">
                      <div class="history-name"><span>过敏史</span></div>
                      <div class="histort-message">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugiat, nulla!</div>
                    </div>
                    <div class="family">
                      <div class="history-name"><span>家族史</span></div>
                      <div class="histort-message">Lorem ipsum dolor sit amet,
                        pisicing elit. Alias deserunt dolores eaque earum li
                        bero maxime quaerat s撒旦阿斯顿阿斯达reiciendis tenetur ullam veniam?</div>
                    </div>
                    <div class="previous">
                      <div class="history-name"><span>既往史</span></div>
                      <div class="histort-message">暂缺</div>
                    </div>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="就诊记录">
                  <div class="record">
                    <div class="record-time">
                      <span class="record-name">选择年份</span>
                      <el-date-picker
                        v-model="value3"
                        type="year"
                        placeholder="请选择年份"
                      />
                    </div>
                    <div class="record-table">
                      <Bluetable :t-head="tRecord" :t-data="tRecordData" :child-open="childOpen" @childOpenData="setTrue" />
                    </div>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="手术记录">
                  <div class="record">
                    <div class="record-time">
                      <span class="record-name">选择年份</span>
                      <el-date-picker
                        v-model="value3"
                        type="year"
                        placeholder="请选择年份"
                      />
                    </div>
                    <div class="record-table">
                      <Bluetable  :t-head="tRecord" :t-data="tRecordData" :child-open="childOpen" @childOpenData="setTrue" />
                    </div>
                  </div>
                </el-tab-pane>
                <el-tab-pane label="用药记录">
                  <div class="record">
                    <div class="record-time">
                      <span class="record-name">选择年份</span>
                      <el-date-picker
                        v-model="value3"
                        type="year"
                        placeholder="请选择年份"
                      />
                    </div>
                    <div class="record-table">
                      <Bluetable  :t-head="tRecord" :t-data="tRecordData" :child-open="childOpen" @childOpenData="setTrue" />
                    </div>
                  </div>
                </el-tab-pane>
              </el-tabs>
            </div>
            <div v-else-if="btnvalue === '2'">
              <el-tabs type="border-card">
                <el-tab-pane label="长期处方">
                  <Bluetable  :t-head="tRecord" :t-data="tRecordData" />
                </el-tab-pane>
                <el-tab-pane label="门诊检验">
                  <Bluetable :t-head="tRecord" :t-data="tRecordData" />
                </el-tab-pane>
                <el-tab-pane label="门诊检查">
                  <Bluetable  :t-head="tRecord" :t-data="tRecordData" />
                </el-tab-pane>
                <el-tab-pane label="病历文件">
                  <span class="record-name">病历文件</span>
                  <el-select v-model="value" clearable placeholder="请选择病历文件">
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-tab-pane>
              </el-tabs>
            </div>
            <div v-else-if="btnvalue === '3'">
              <el-tabs type="border-card">
                <el-tab-pane label="住院临时医嘱">
                  <Bluetable  :t-head="tRecord" :t-data="tRecordData" />
                </el-tab-pane>
                <el-tab-pane label="住院长期医嘱">
                  <Bluetable :t-head="tRecord" :t-data="tRecordData" />
                </el-tab-pane>
                <el-tab-pane label="住院检验信息">
                  <Bluetable  :t-head="tRecord" :t-data="tRecordData" />
                </el-tab-pane>
                <el-tab-pane label="住院检查信息">
                  <Bluetable :t-head="tRecord" :t-data="tRecordData" />
                </el-tab-pane>
              </el-tabs>
            </div>

          </div>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Card from '../../../prc/childComps/card/Card'
export default {
  components: {
    Card
  },
  data() {
    return {
      query: {
        total: 100,
        page: 1,
        limit: 10
      },
      tHead: [
        {
          operate: ['查看病人信息'],
          label: '操作'
        },
        {
          prop: 'date',
          label: '患者姓名'
        },
        {
          prop: 'date',
          label: '性别'
        },
        {
          prop: 'date',
          label: '入院时间'
        },
        {
          prop: 'date',
          label: '病区'
        },
        {
          prop: 'date',
          label: '诊断'
        }],
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '111'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '111'
      }],
      tRecord: [
        {
          prop: 'date',
          label: '日期'
        },
        {
          prop: 'address',
          label: '诊室'
        },
        {
          prop: 'name',
          label: '医生'
        }],
      tRecordData: [{
        date: '2016-05-02',
        name: '王小虎',
        address: '普外科门诊'
      }, {
        date: '2016-05-04',
        name: '王小虎',
        address: '111'
      }],
      childOpen: false,
      value3: '',
      btnvalue: '1',
      type1: 'primary',
      type2: 'info',
      type3: 'info',
      options: [{
        value: '选项1',
        label: '黄金糕'
      }, {
        value: '选项2',
        label: '双皮奶'
      }, {
        value: '选项3',
        label: '蚵仔煎'
      }, {
        value: '选项4',
        label: '龙须面'
      }, {
        value: '选项5',
        label: '北京烤鸭'
      }],
      value: ''
    }
  },
  // :class="[isActive?'change':'changs']"
  methods: {
    // 按钮切换
    changeBtn(btnvalue) {
      this.btnvalue = btnvalue
      btnvalue === '1' ? this.type1 = 'primary' : this.type1 = 'info'
      btnvalue === '2' ? this.type2 = 'primary' : this.type2 = 'info'
      btnvalue === '3' ? this.type3 = 'primary' : this.type3 = 'info'
    },
    getList() {
      console.log(1)
    },
    setTrue(res) {
      var selectBtn = this.$refs.blueTable.selectBtn
      if (selectBtn === '查看病人信息') {
        this.childOpen = res
      }
    }
  }
}
</script>

<style scoped lang="scss">
  /deep/.el-dialog__body{
    padding: 0;
  }
  /deep/.el-dialog__header{
    margin-bottom: 0;
  }
  /deep/.el-button--primary{
    width: 100%;
  }
  /deep/.el-button--info{
    width: 100%;
  }
  /deep/.el-tabs__content{
    height: 350px;
  }
  /deep/.el-dialog{
    width: 1150px;
    height: 576px;
  }
  /deep/.el-dialog{
    display: flex;
    flex-direction: column;
    margin:0 !important;
    position:absolute;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    /*height:600px;*/
  }
  /*/deep/.el-dialog .el-dialog__body{*/
  /*  flex:1;*/
  /*  overflow: auto;*/
  /*}*/






  .wrapper{
    background-color: #e6edf5;
    height: 576px;

    display: flex;
    .content-left{
      width: 145px;
      padding: 5px 5px;
      background-color: #fff;
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      align-content: start;
      justify-content: center;
      .btns{
        width: 100%;
        margin: 5px;

      }
    }
    .content-right{
      .right-top{
        width: 985px;
        padding: 20px;
        .cardBody{
          display: flex;
          .body-left{
            font-size: 24px;
            padding-right: 20px;
            border-right: 1px solid #f1f1f1;
          }
          .body-right{
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            margin-left: 20px;
            .body-right-top{
              width: 100%;
              display: flex;
              font-size: 16px;
              .age{
                margin-left: 10px;
              }

            }
            .body-right-bottom{
              width: 100%;
              display: flex;
              margin-top: 5px;
              .item{
                display: flex;
                margin-right: 20px;
                .item-key{
                  color: #909399;
                }
                .item-value{
                  margin-left: 10px;
                }
              }
            }
          }
        }
      }
      .right-bottom{
        padding: 0 20px;
        width: 985px;
        .medical-history{
          .history-name{
            span{
              background-color: #409eff;
              font-size: 14px;
              padding: 2px 10px;
              color: #ffffff;
              width: 65px;
              height: 20px;
              border-radius: 2px;
            }
            padding-bottom: 5px;
          }
          .histort-message{
            margin-left: 10px;
            padding-bottom: 5px;
            line-height: 25px;

          }
        }
        .record{
          font-size: 12px ;
          .record-table{
            margin-top: 20px;
          }
        }

      }
    }
  }
</style>
